# -*- coding: utf8-*-
#
#
# def a(x,y):
#     for n_1,i in enumerate(x):
#         for n_j,j in enumerate(x[n_1+1:]):
#             if i+j == y:
#                 return [n_1+1,n_j+n_1+1+1]
#
# x = [3,2]
# print a(x,5)
# 0.2,
import timeit


def searchInsert(nums, target):
    low, high = 0, len(nums) - 1
    
    while low <= high:
        mid = (low + high) / 2
        if nums[mid] == target:
            return mid
        elif nums[mid] > target:
            high = mid - 1
        else:
            low = mid + 1
    
    return low




xxx = range(100000000)

def a():
    low, high = 0,0

t2 = timeit.timeit('searchInsert(nums, target)',setup="from __main__ import searchInsert;nums=[1          ];target=1 ",number=100000)

print t2
